import torch

torch.manual_seed(555)

# 创建张量

t = torch.randint(1,10,size = (2,3),dtype = torch.float32)

print(t)
print(t.sum(dim = 0))
print(t.sum(dim = 1))

print(t.mean())
print(t.mean(dim = 0)) # dim = 0 就是按照列来求均值
print(t.mean(dim = 1))


print(t.pow(2)) # 打印t的平方
print(t.pow(3)) # 打印t的立方

print(t.sqrt()) # 打印t的自然对数
print(t.log2()) # 打印t的以2为底的对数
print(t.log10()) # 打印t的以10为底的对数

import math

print(math.e)
print(math.pi)
print(math.sqrt(16))